<?php

namespace app\home\controller;

use think\Controller;
use think\Request;

class Goods extends Base
{
    public function list()
	{
		$id=input('id');
		$list=\app\common\model\Goods::where('cate_id',$id)->paginate(10);
		$categorynav=\app\common\model\Category::find($id);
		return view('list',['list'=>$list,'categorynav'=>$categorynav]);
	}
	
	public function item()
	{
		$params=input();
		dump($params);
		$item=\app\common\model\Goods::find($params['id']);
		dump($item['goods_attr']);
		$goodsimages=\app\common\model\GoodsImages::where('goods_id',$params['id'])->select();
		$categoryname=\app\common\model\Category::where('id',$params['cate_id'])->select();
		//dump($categoryname[0]['cate_name']);
		$typeid=\app\common\model\Type::where('type_name',$categoryname[0]['cate_name'])->select();
		//dump($typeid[0]['id']);
		$spec=\app\common\model\Spec::where('type_id',$typeid[0]['id'])->select();
		//dump($spec[0]['id']);
		//dump($spec[1]['id']);
		$specvalue=\app\common\model\SpecValue::where('spec_id',$spec[0]['id'])->select();
		//dump($specvalue);
		$brand=\app\common\model\Brand::where('id',$params['brand_id'])->select();
		//dump($brand[0]['name']);
		//return view('item',['item'=>$item,'goodsimages'=>$goodsimages,'specvalue'=>$specvalue,'brand'=>$brand[0]['name']]);
	}
}
